package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.orderB.entity.OceanCustomerPlan;
import com.egao.orderB.service.OceanCustomerPlanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


/**
 *
 * 海运客户计划
 * @author : Doman
 * @date : 2021-11-10 16:32:48
 * @version ：1.0
 */

@Api(tags = "海运客户计划")
@RestController
@RequestMapping("/api/orderB/oceanCustomerPlan")
public class OceanCustomerPlanController extends BaseController {

	@Autowired
	private OceanCustomerPlanService oceanCustomerPlanService;

	/**
	 * 分页查询列表
	 */
	@PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:list')")
  @ApiOperation(value ="分页查询海运客户计划",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    "customer:客户名称\n" +
    "ship:船公司\n" +
    "boxType:箱型\n" +
    "goShipDay:开船日\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "ship:船公司\n" +
    "vessel:船名\n" +
    "voyage:航次\n" +
          "airRoute:航线\n" +
    "goShipDay:开船日\n" +
    "deposit:押金\n" +
    "depositPath:押金路径 对公，对私，蔡总\n" +
    "entrustmentAnnex:托书文件\n" +
    "boxType:箱型\n" +
    "price:金额\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/list")
  public JsonResult page(PageResult2<T> page, OceanCustomerPlan oceanCustomerPlan) throws Exception{
    return oceanCustomerPlanService.list(page, oceanCustomerPlan, getLoginUser());
  }

	/**
	 * 分页查询列表
	 */
	@PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:list')")
  @ApiOperation(value ="分页查询海运客户计划",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    "customer:客户名称\n" +
    "ship:船公司\n" +
    "boxType:箱型\n" +
    "goShipDay:开船日\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "ship:船公司\n" +
    "vessel:船名\n" +
    "voyage:航次\n" +
          "airRoute:航线\n" +
    "goShipDay:开船日\n" +
    "deposit:押金\n" +
          "depositPath:押金路径 对公，对私，蔡总\n" +
    "entrustmentAnnex:托书文件\n" +
    "boxType:箱型\n" +
    "price:金额\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/cancelList")
  public JsonResult cancelList(PageResult2<T> page, OceanCustomerPlan oceanCustomerPlan) throws Exception{
    oceanCustomerPlan.setDeleted(2);
    return oceanCustomerPlanService.list(page, oceanCustomerPlan, getLoginUser());
  }


  @PostMapping("/listOpen")
  @ApiOperation(value = "海运客户计划展开查询",notes = "" +
          "id:海运客户计划id\n" +
          "\n",httpMethod = "POST")
  public JsonResult listOpen(OceanCustomerPlan oceanCustomerPlan, HttpServletRequest request) {
    return oceanCustomerPlanService.listOpen(oceanCustomerPlan, getLoginUser());
  }


  /**
   * 查询全部海运客户计划
   */
  @PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:list')")
  @ApiOperation("查询全部海运客户计划")
  @PostMapping("/listAll")
  public JsonResult list(OceanCustomerPlan oceanCustomerPlan){
    return oceanCustomerPlanService.list(oceanCustomerPlan, getLoginUser());
  }

  /**
   * 根据id查询海运客户计划
   */
  @PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:list')")
  @ApiOperation("根据id查询海运客户计划")
  @PostMapping("/get")
  public JsonResult get(OceanCustomerPlan oceanCustomerPlan) {
    return oceanCustomerPlanService.getById(oceanCustomerPlan);
  }


  /**
   * 添加海运客户计划
   */
  @PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:save')")
  @OperLog(value = "海运客户计划", desc = "添加", param = false, result = true)
  @ApiOperation(value ="添加海运客户计划",notes = "" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "ship:船公司\n" +
    "vessel:船名\n" +
    "voyage:航次\n" +
          "airRoute:航线\n" +
    "goShipDay:开船日\n" +
    "deposit:押金\n" +
          "depositPath:押金路径 对公，对私，蔡总\n" +
    "entrustmentAnnex:托书文件\n" +
    "boxType:箱型\n" +
    "price:金额\n" +
    "",httpMethod = "POST")
  @PostMapping("/save")
  public JsonResult save(Model model, OceanCustomerPlan oceanCustomerPlan) {
    return oceanCustomerPlanService.save(oceanCustomerPlan, getLoginUser());
  }

  /**
   * 修改海运客户计划
   */
  @PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:update')")
  @OperLog(value = "海运客户计划", desc = "修改", param = false, result = true)
  @ApiOperation(value ="修改海运客户计划",notes = "" +
    "id:id\n" +
    "customerId:客户id\n" +
    "customer:客户\n" +
    "ship:船公司\n" +
    "vessel:船名\n" +
    "voyage:航次\n" +
          "airRoute:航线\n" +
    "goShipDay:开船日\n" +
    "deposit:押金\n" +
          "depositPath:押金路径 对公，对私，蔡总\n" +
    "entrustmentAnnex:托书文件\n" +
    "boxType:箱型\n" +
    "price:金额\n" +
    "",httpMethod = "POST")
  @PostMapping("/update")
  public JsonResult update(Model model, OceanCustomerPlan oceanCustomerPlan) {
    return oceanCustomerPlanService.update(oceanCustomerPlan, getLoginUser());
  }

  /**
   * 删除海运客户计划
   */
  @PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:remove')")
  @OperLog(value = "海运客户计划", desc = "删除", result = true)
  @ApiOperation(value ="删除海运客户计划",notes = "" +
    "id:id\n" +
    "",httpMethod = "POST")
  @PostMapping("/remove")
  public JsonResult remove(OceanCustomerPlan oceanCustomerPlan ) {
    return oceanCustomerPlanService.remove(oceanCustomerPlan, getLoginUser());
  }

  /**
   * 删除海运客户计划
   */
  @PreAuthorize("hasAuthority('orderB:oceanCustomerPlan:remove')")
  @OperLog(value = "取消海运客户计划", desc = "删除", result = true)
  @ApiOperation(value ="取消海运客户计划",notes = "" +
    "id:id\n" +
    "",httpMethod = "POST")
  @PostMapping("/cancel")
  public JsonResult cancel(OceanCustomerPlan oceanCustomerPlan ) {
    return oceanCustomerPlanService.cancel(oceanCustomerPlan, getLoginUser());
  }

}
